package com.btex.app.adapter;

import android.support.annotation.Nullable;

import com.btex.app.MyApplication;
import com.btex.app.tools.SharedPreferencesUtil;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.btex.app.R;
import com.btex.app.entity.MyInfoListInfo;

import java.util.List;

/**
 * @author zy zhangyi <zhangyi, 1104745049@QQ.com
 * @version v1.0
 * @project study1
 * @Description
 * @encoding UTF-8
 * @date 2018/5/18
 * @time 下午6:06
 * @修改记录 <pre>
 * 版本       修改人         修改时间         修改内容描述
 * --------------------------------------------------
 * <p>
 * --------------------------------------------------
 * </pre>
 */

public class FragmentTradeAdapter extends BaseQuickAdapter<MyInfoListInfo.DataBean.CoinsBean, BaseViewHolder> {
    public FragmentTradeAdapter(@Nullable List<MyInfoListInfo.DataBean.CoinsBean> data) {
        super(R.layout.item_property_fragment, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, MyInfoListInfo.DataBean.CoinsBean item) {

        SharedPreferencesUtil sharedPreferences = SharedPreferencesUtil.getSharedPreferences(MyApplication.getContextObject());
        boolean isEngilsh = sharedPreferences.getBoolean("isEngilsh", false);
        String type = item.getType();

        helper.addOnClickListener(R.id.item_trade_list_zhuan_ru);
        helper.addOnClickListener(R.id.item_trade_list_zhuan_chu);

        helper.setText(R.id.item_trade_list_name, item.getType());
        helper.setText(R.id.item_trade_list_tv_money_y, item.getBalance());
        helper.setText(R.id.item_trade_list_tv_money_n, item.getFrozen());
        if (isEngilsh) {
            helper.setText(R.id.item_trade_list_tv_money_cny, item.getTotal_guzhi_USDT() + "\t" + "($)");

        } else {
            helper.setText(R.id.item_trade_list_tv_money_cny, item.getTotal_guzhi_CNY() + "\t" + "(CNY)");
        }

        helper.setText(R.id.item_trade_list_tv_total_money, item.getTotal());


    }
}
